package com.david.zhufengfm.entity.album;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by David on 2015/10/24.
 * qq:978944820
 */
public class PlayTrack implements Parcelable {

    private int trackId;
    private int uid;
    private String playUrl64;
    private String playUrl32;
    private String downloadUrl;
    private String playPathAacv164;
    private String playPathAacv224;
    private String title;
    private double duration;

    public PlayTrack() {
    }

    public void setTrackId(int trackId) {
        this.trackId = trackId;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public void setPlayUrl64(String playUrl64) {
        this.playUrl64 = playUrl64;
    }

    public void setPlayUrl32(String playUrl32) {
        this.playUrl32 = playUrl32;
    }

    public void setDownloadUrl(String downloadUrl) {
        this.downloadUrl = downloadUrl;
    }

    public void setPlayPathAacv164(String playPathAacv164) {
        this.playPathAacv164 = playPathAacv164;
    }

    public void setPlayPathAacv224(String playPathAacv224) {
        this.playPathAacv224 = playPathAacv224;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setDuration(double duration) {
        this.duration = duration;
    }

    public int getTrackId() {
        return trackId;
    }

    public int getUid() {
        return uid;
    }

    public String getPlayUrl64() {
        return playUrl64;
    }

    public String getPlayUrl32() {
        return playUrl32;
    }

    public String getDownloadUrl() {
        return downloadUrl;
    }

    public String getPlayPathAacv164() {
        return playPathAacv164;
    }

    public String getPlayPathAacv224() {
        return playPathAacv224;
    }

    public String getTitle() {
        return title;
    }

    public double getDuration() {
        return duration;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * 将对象转化为字节数据，进行序列化操作
     *
     * @param out
     * @param flags
     */
    @Override
    public void writeToParcel(Parcel out, int flags) {

        out.writeInt(trackId);
        out.writeInt(uid);
        out.writeString(playUrl64);
        out.writeString(playUrl32);
        out.writeString(downloadUrl);
        out.writeString(playPathAacv164);
        out.writeString(playPathAacv224);
        out.writeString(title);
        out.writeDouble(duration);
    }


    public static final Parcelable.Creator<PlayTrack> CREATOR
            = new Parcelable.Creator<PlayTrack>() {
        /**
         * 反序列化的方法，这个方法与writeToPacel对应
         * 从Parcel可以获取相应的类型
         * @param in
         * @return
         */
        public PlayTrack createFromParcel(Parcel in) {
//            PlayTrack track =new PlayTrack();
//            track.trackId=in.readInt();
            return new PlayTrack(in);
        }

        /**
         * 当反序列化的是一个数组的时候，调用这个方法
         * @param size 数组元素对象的个数
         * @return
         */
        public PlayTrack[] newArray(int size) {
            return new PlayTrack[size];
        }
    };

    private PlayTrack(Parcel in) {

        trackId = in.readInt();
        uid = in.readInt();
        playUrl64=in.readString();
        playUrl32=in.readString();
        downloadUrl=in.readString();
        playPathAacv164=in.readString();
        playPathAacv224=in.readString();
        title=in.readString();
        duration=in.readDouble();

    }

}
